package com.mobilesalon.business;

import java.util.Arrays;
import java.util.List;

import android.content.SharedPreferences;

import com.mobilesalon.R;
import com.mobilesalon.widget.preference.ListPreferenceMultiSelect;

public class PreferencesManager {
	private final SharedPreferences prefs;

	public PreferencesManager(SharedPreferences prefs) {
		this.prefs = prefs;
	}

	public List<String> getSelectedCalendarsOwners() throws ConfigurationException {
		String calendarsString = prefs.getString("preference_list_calendar_selection", null);
		if (calendarsString == null || calendarsString.isEmpty()) {
			throw new ConfigurationException(R.string.preference_calendar_selection_not_done);
		}

		return Arrays.asList(calendarsString.split(ListPreferenceMultiSelect.SEPARATOR));

	}

	public String getReportsRecipents() {
		return prefs.getString("preference_reports_mail_recipients", "");
	}

}
